package com.fmyexample.mcsecurityboot.config.security;

import com.fmy.mcsecurity.login.service.JiUserDetails;
import com.fmyexample.mcsecurityboot.modular.model.User;
import org.springframework.security.core.GrantedAuthority;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @author Mr.fmy
 * @version 1.0.0
 * @ClassName CuUserDetails
 * @Description TODO 自定义 UserDetails
 * @createTime 2020/4/15 11:46
 */
public class CuUserDetails extends User implements JiUserDetails {

    private String token;

    private String refreshToken;

    @Override
    public String userId() {
        return super.getUserId();
    }

    @Override
    public String token() {
        return token;
    }

    @Override
    public String refreshToken() {
        return refreshToken;
    }

    @Override
    public void token(String token) {
        this.token = token;
    }

    @Override
    public void refreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return new ArrayList<>();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
